using System.Xml;
using MbUnit.Framework;
using XmlObjects;
using XmlObjects.Types.CCNet;
using XmlObjects.Types.CCNet.Triggers;

namespace XmlImportUnitTests
{
	[TestFixture]
	public class TestReadProject
	{
		private XmlNode projectNode;
		private Hydrator<CCNetProject> hydrator;
		private CCNetProject ccNetProject;

		[Test]
		public void TestOne()
		{
			Assert.AreEqual(2, ccNetProject.ModificationDelaySeconds);
			Assert.AreEqual("Introvert", ccNetProject.Name);
			Assert.IsNotNull(ccNetProject.Triggers);
			Assert.IsNotNull(ccNetProject.Triggers[0]);
			Assert.AreEqual(ccNetProject.Triggers[0].GetType(), typeof(IntervalTrigger));

		}

		[SetUp]
		public void SetUp()
		{
			hydrator = new Hydrator<CCNetProject>();

			XmlDocument document = new XmlDocument();
			document.Load("ccnet.project.xml");
			projectNode = document.SelectSingleNode("/project");
			Assert.IsNotNull(projectNode);
			ccNetProject = hydrator.GetValueLocal(projectNode);
		}
	}
}